package com.example.tests;

import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.*;
import java.util.Random;
import com.example.utils.SortedListOf;
import org.testng.annotations.Test;
//import com.example.fw.GroupHelper;

public class GroupRemovalTests extends TestBase{

	@Test
	public void deleteSomeGroup() {
		app.navigateTo().mainPage();
		app.navigateTo().groupsPage();
		
		//save old state
		SortedListOf<GroupData> oldList = app.getGroupHelper().getGroups();
		
		Random rnd = new Random();
		int index = rnd.nextInt(oldList.size()-1);
		
		//actions
		app.getGroupHelper().deleteGroup(index);
		  
		
		//save new state
		SortedListOf<GroupData> newList = app.getGroupHelper().getGroups();
						
		//compare states
		assertThat(newList, equalTo(oldList.without(index)));					
		
	
	
	}
	
}
